package com.bit.cfdi.web.domain;

import static javax.persistence.GenerationType.IDENTITY;

import java.io.Serializable;
import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

@Entity
@Table(name = "regimen_comprobante")
public class RegimenComprobante implements Serializable {

	private static final long serialVersionUID = 1L;
	// Fields

	private Long idRegimenComprobante;
	private Comprobante comprobante;
	private Regimen regimen;
	private Calendar fechaUltimaSeleccion;
	private Long ultimaModificacionPor;
	private Calendar fechaModificacion;	
	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id_regimen_comprobante", nullable = false)
	public Long getIdRegimenComprobante() {
		return this.idRegimenComprobante;
	}

	public void setIdRegimenComprobante(Long idRegimenComprobante) {
		this.idRegimenComprobante = idRegimenComprobante;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "id_comprobante", nullable = false)
	public Comprobante getComprobante() {
		return this.comprobante;
	}

	public void setComprobante(Comprobante comprobante) {
		this.comprobante = comprobante;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "id_regimen", nullable = false)
	public Regimen getRegimen() {
		return this.regimen;
	}

	public void setRegimen(Regimen regimen) {
		this.regimen = regimen;
	}

	@Column(name = "fecha_ultima_seleccion")
	@Temporal(TemporalType.TIMESTAMP)
	public Calendar getFechaUltimaSeleccion() {
		return this.fechaUltimaSeleccion;
	}

	public void setFechaUltimaSeleccion(Calendar fechaUltimaSeleccion) {
		this.fechaUltimaSeleccion = fechaUltimaSeleccion;
	}
	
	@Column(name = "ultima_modificacion_por")
	public Long getUltimaModificacionPor() {
		return this.ultimaModificacionPor;
	}

	public void setUltimaModificacionPor(Long ultimaModificacionPor) {
		this.ultimaModificacionPor = ultimaModificacionPor;
	}

	@Column(name = "fecha_modificacion")
	@Temporal(TemporalType.TIMESTAMP)
	@Version
	public Calendar getFechaModificacion() {
		return this.fechaModificacion;
	}

	public void setFechaModificacion(Calendar fechaModificacion) {
		this.fechaModificacion = fechaModificacion;
	}

}